package com.xinghou.platform.server.api.controller;

import com.xinghou.platform.entity.req.MsgInfoReq;
import com.xinghou.platform.entity.resp.MsgInfoResp;
import com.xinghou.platform.server.api.bussiness.MessageBusinessService;
import com.xinghou.platform.server.api.bussiness.MsgInfoBusinessService;
import com.xinghou.platform.util.ConfigUtil;
import com.xinghou.platform.util.JsonUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;

/**
 * 消息服务类
 * @author xuzhen
 *
 */
@Controller
public class MsgInfoController extends BaseControl {
	private String key = ConfigUtil.getProperty("HTTP_SERVICE_KEY");
	
	private String reqjson;//请求json
	private String repjson;//返回json
	
	private boolean bool = true;
	
	@Resource
	private MsgInfoBusinessService msgInfoBusinessService;
	/**
	 * 用户位置信息上送
	 * @param msgInfoReq
	 * @param request
	 * @param response
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "/updateUserGPS", method = {RequestMethod.POST})
	public String  updateUserGPS(@RequestBody MsgInfoReq msgInfoReq,
			HttpServletRequest request, HttpServletResponse response){
		Map<String,String> requestContent = new HashMap<String, String>();
		MsgInfoResp msgInfoResp = new MsgInfoResp();
		msgInfoBusinessService.sendUpdateGPSMessage(msgInfoReq);
		repjson = JsonUtil.toJson(msgInfoResp);
		return response(msgInfoResp);
	}
	public String getReqjson() {
		return reqjson;
	}
	public void setReqjson(String reqjson) {
		this.reqjson = reqjson;
	}
	public String getRepjson() {
		return repjson;
	}
	public void setRepjson(String repjson) {
		this.repjson = repjson;
	}
	public boolean isBool() {
		return bool;
	}
	public void setBool(boolean bool) {
		this.bool = bool;
	}

}
